#define form(col,value)
	<div class="space-4"></div>
		<!-- #section:elements.form -->
			#for(x : col)
			 #if(!ifEmpty(x.title))
					<div class="page-header-form">
						<h2>
							#(x.title??)
						#if(!ifEmpty(x.small))
							<small>
								<i class="ace-icon fa fa-angle-double-right">
									#(x.small??)
								</i>
							</small>
						#end
						</h2>
					
					</div>
			 #else
			        #setLocal(display = (like(x.type,"hidden")) ? "none" : "block")
			        #setLocal(placeholder = (!ifEmpty(x.placeholder)) ? x.placeholder : ("暂无"+x.name))
				    #if(x.newline)
						<div class="form-group" style="display:#(display??)">
				    #end
							<label class="col-sm-2 control-label no-padding-right" > #(x.name??) </label>			
							<div class="col-sm-#(x.length??3)">
							#if(x.type=="textarea")
								<textarea id="_#(x.index??)" style="height:#(x.height??'200px')" name="#(table??).#(x.index??)" disabled value="#(x.value??)" placeholder="#(placeholder??)" class="form-control"></textarea>
							#else if(x.type=="image")
								<img id="_#(x.index??)"  data-type="image" data-auto="#(x.auto??)" style="padding:2px; border:1px solid #ccc;cursor:pointer;width:#(x.width??'168px');height:#(x.height??'110px');" name="#(table??x.table).#(x.index??)" src="#(x.src??)"></img>
							#else if(x.type=="kindeditor")
							     #@kindeditor(x)
							#else if(x.type=="ueditor")
								 #@ueditor(x)
							#else if(x.type=="checkbox")
								 #@checkbox(x)
							#else if(x.type=="checkbox2")
								 #@checkbox2(x)
							#else if(x.type=="imgupload")
								#@imgupload(x)
							#else if(x.type=="multiimgupload")
							    #@multiimgupload(x)
							#else if(x.type=="fileupload")
								 #@fileupload(x)
						    #else if(like(x.type,"opentree"))
								#@opentree(x,placeholder)
							#else if(x.type=="hidden")
								<input type="hidden" id="_#(x.index??)" name="#(table??).#(x.index??)"  value="#(x.value??)" />
							#else if(x.type=="span")
								<span id="_#(x.index??)" class="form-control" style="border:0px;">#(x.value??)</span>
							#else
								<input type="text" id="_#(x.index??)" name="#(table??).#(x.index??)" disabled value="#(x.value??)" placeholder="#(placeholder??)" class="form-control" />
							#end
							</div>
							#if(x.length>=5)
								</div>
							#end
				     #if(!x.newline)
					 </div>
				     #end
				  #end
			 #end
			<script	type="text/javascript">
				$(function(){
					var _model = #(value??"'error'");
					if(_model == "error"){
						layer.msg('读取数据失败!', {icon: 5});
						return;
					}
					for(var x in _model){
						var child = _model[x];
					    setVal(x,child);
					}
					
				});
				//为元素赋值
				function setVal(id,value){//id当前元素id,value 需要的值
					var je = $("#_" + id);
					if(value != null && je.attr("data-type")=="image"){
						var src = je.attr("data-auto") + value;
						je.attr("src", src);
						je.bind("click", function(){
							window.open($(this).attr("src"));
						});
					}
					else if(value != null && je.attr("data-type") == "imgupload"){
						var id = value;
						initImgUpload(id, "view");
						je.val(id);
					}
					else if(value != null && je.attr("data-type") == "multiimgupload"){
						var id = value;
						initMultiImgUpload(id, "view");
						je.val(id);
					}
					else if(value != null && je.attr("data-type") == "fileupload"){
						var ids = value;
						initFileUpload(ids, "view");
						je.val(ids);
					}
					else if(value != null && je.attr("data-type") == "opentree"){
						var ids = value;
						je.val(ids);
						initOpenTree(ids);
					}
					else if(je.is("span")){
						var _x = value;
						if(_x == null || _x == ""){
							_x = "请选择";
						}
						je.html(_x);
					}
					else if(value!=null && $("#" + id + "_chb").attr("type")=="checkbox"){
						if(value=="1"){
							$("#"+id+"_chb").attr("checked", "checked");
						}
						else{
							je.removeAttr("checked");
						}
					}
					else if(value!=null && je.is("div") && je.attr("class").indexOf("edui")>0){
						//适配ueditor
						editor.setContent(value);
					}
					else {
						je.val(value);
					}
				}
			</script>
			
			
	<div class="space-4"></div>
#end